package cn.zhengzhou.springbootmybatis.controller;

import cn.zhengzhou.springbootmybatis.mapper.StudentsMapper;
import cn.zhengzhou.springbootmybatis.pojo.ResultVo;
import cn.zhengzhou.springbootmybatis.pojo.Students;
import cn.zhengzhou.springbootmybatis.service.StudentService;
import cn.zhengzhou.springbootmybatis.service.StudentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class StudnetsController {
    @Autowired
    private StudentsService studentsService;

    @GetMapping("/students")
    public ResultVo<List<Students>> getStudents() {
        List<Students> s = studentsService.findStudents();
        return ResultVo.success(s);
    }
}
